<%@ include file="includeTop.jsp" %>
<html>
<head>
<title></title>
<%@ include file="includeTop_head.jsp" %>
</head>
<body>
<table height="100" width="100%" align="center"
	style="padding: 0; margin: 0" border=0>
	<tr>
		<td colspan="3"><%@ include file="user_status.jsp"%></td>
	</tr>
	<tr class="title">
		<td><%@ include file="title.jsp"%></td>
		<td align="center"><%@ include file="cartbar.jsp"%></td>
	</tr>
	<tr>
		<td colspan="3" height="70%">
		<table border=0 style="padding: 0; margin: 0">
			<tr>
				<td width="197" valign="top"><%@ include
					file="account_left.jsp"%></td>
				<Td width="30"></Td>
				<td width="80%" valign="middle"><c:if test="${empty addresses}">
					<b>No Saved Address.</b>
				</c:if>
				<table class="addresssub" width="90%" style="padding: 0; margin: 0">
					<tr height=25px>
						<th class="first" colspan="5" align="left">Saved Addresses</th>
					</tr>
					<c:forEach var="address" items="${addresses}" varStatus="status">
						<c:if test="${status.index % 4 eq 0}">
							<tr>
						</c:if>
						<td width="250">
						<table class="product" width="250">
							<tr>
								<th colspan="5" align="left"><c:out
									value="${status.index + 1}" /></th>
							</tr>
							<tr height="18">
								<td align="right" nowrap>First name:</td>
								<td width="80%"><c:out value="${address.firstName}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Last name:</td>
								<td><c:out value="${address.firstName}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Address :</td>
								<td colspan="3" nowrap><c:out value="${address.address1}" />
								<c:out value="${address.address2}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Surburb :</td>
								<td><c:out value="${address.surburb}" /></td>
							</tr>
							<tr height="18">
								<td align="right">State:</td>
								<td><c:out value="${address.state}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Postcode:</td>
								<td><c:out value="${address.postcode}" /></td>
							</tr>
							<tr height="18">
								<td align="right">City:</td>
								<td><c:out value="${address.city}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Country:</td>
								<td><c:out value="${address.country}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Phone:</td>
								<td><c:out value="${address.phone1}" /></td>
							</tr>
							<tr height="18">
								<td align="right">Email:</td>
								<td><c:out value="${address.email}" /></td>
							</tr>
							<tr>
								<td colspan=3 align="right">
								<form action="<c:url value="/account/editAddress.do"/>" method="post">
								<input type="hidden" name="addressId"
									value="<c:out value="${address.id}"/>" /> <input name="action"
									type="submit" value="Edit" /> <c:if
									test="${!address.defaultR}">
									<input name="action" type="submit" value="Delete" />
								</c:if>&nbsp;</form>
								</td>
							</tr>
						</table>
						</td>
						<c:if test="${status.index % 4 eq 3}">
							<td></td>
							</tr>
						</c:if>
					</c:forEach>
					<Td></Td>
					</tr>
					<tr>
						<td colspan="4"><input name="action" type="button"
							value="Add New Address" /></td>
					</tr>
				</table>
				<br>
				<div class="addresssub">
				<ul>
					<li class="first">Edit/Add Address</li>
				</ul>
				<ul>
					<li>
					<form action="<c:url value="/account/saveAddress.do"/>" method="post">
					<spring:bind path="address.id">
						<input type="hidden" name="<c:out value="${status.expression}"/>"
							value="<c:out value="${status.value}"/>" />
					</spring:bind> <spring:bind path="address.defaultR">
						<input type="hidden" name="<c:out value="${status.expression}"/>"
							value="<c:out value="${status.value}"/>" />
					</spring:bind>
					<table class="edit">
						<tr>
							<td width="100" align="right">First name:</td>
							<td width="100"><spring:bind path="address.firstName">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
							<td width="100" align="right">Last name:</td>
							<td width="100"><spring:bind path="address.lastName">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">Address :</td>
							<td colspan="3"><spring:bind path="address.address1">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" size="57" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right"></td>
							<td colspan="3"><spring:bind path="address.address2">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" size="57" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">Surburb :</td>
							<td><spring:bind path="address.surburb">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">State:</td>
							<td><spring:bind path="address.state">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
							<td align="right">Postcode:</td>
							<td><spring:bind path="address.postcode">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">City:</td>
							<td><spring:bind path="address.city">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
							<td align="right">Country:</td>
							<td><spring:bind path="address.country">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">Contact No:</td>
							<td><spring:bind path="address.phone1">
								<input type="text" name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td align="right">Email:</td>
							<td colspan="3" align="left"><spring:bind
								path="address.email">
								<input type="text" size="57"
									name="<c:out value="${status.expression}"/>"
									value="<c:out value="${status.value}"/>" />
							</spring:bind></td>
						</tr>
						<tr>
							<td colspan=3 align="center"><input name="action"
								type="submit" value="Submit Address" /></td>
						</tr>
					</table>
					</form>
					</li>
				</ul>
				</div>
				</td>
			</tr>
			<tr>
				<td></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td colspan="3"><%@ include file="includeBottom.jsp"%></td>
	</tr>
</table>
</body>
</html>
